package util.toolkit;

public class StringArraySort {

	/**
	 * 字符数组串排序
	 * @param input 数组
	 * @return 返回排序后的数组
	 */
	public static String[] arraySort(String[] input) {
		for (int i = 0; i < input.length - 1; i++) {
			for (int j = 0; j < input.length - i - 1; j++) {
				if (input[j].compareTo(input[j + 1]) > 0) {
					String temp = input[j];
					input[j] = input[j + 1];
					input[j + 1] = temp;
				}
			}
		}
		return input;
	}

	public static void main(String[] args) {

		String[] input = new String[] {"C、经常&", "A、没有&", "B、有&"};
		String[] keys = arraySort(input);
		for (String key : keys) {
			System.out.println(key);
		}

	}

}
